package com.demo.listener;

import com.demo.pojo.User;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@RabbitListener(queues = {"order.release.order.queue"})
@Component
@Slf4j
public class listener3 {

    @RabbitHandler
    public void listener(User user, Channel channel, Message message) throws IOException {
        try {
            System.out.println(user);
            System.out.println(message);
            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        } catch (Exception e) {
        }
    }
}
